package server

var routeTable map[string]map[string]func (req Request, res Response) string

func init() {
	//双重map映射路径和方法
	routeTable = make(map[string]map[string]func (req Request, res Response) string)
	methodTable := make(map[string]func (req Request, res Response) string)
	methodTable[GET] = HelloWorld
	routeTable["/healthz"] = methodTable
}

// PathRoute path路径找到匹配的controller中的处理函数，这里只是做个简单的缓存
func PathRoute(path string, method string) func (req Request, res Response) string {
	return routeTable[path][method]
}

